package com.jinlia.show.modules.base.model.po;

import com.jinlia.show.modules.base.system.entity.MemberCard;
import com.jinlia.show.modules.base.wxapp.entity.User;
import com.jinlia.show.modules.base.wxapp.entity.UserRole;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.List;

@Data
public class UserPO extends User {

    private List<UserRole> userRoles;

    public MemberCard memberCard;

    public static UserPO fromEntity(User entity) {
        UserPO vo = new UserPO();
        BeanUtils.copyProperties(entity, vo);
        return vo;
    }

    public static User toEntity(UserPO vo) {
        User entity = new User();
        BeanUtils.copyProperties(vo, entity);
        return entity;
    }
}
